package com.example.tree.controller;

import com.example.tree.pojo.MenuTreeDto;
import com.example.tree.pojo.RespBody;
import com.example.tree.service.UserInfoService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 张翰林
 */

@RestController
public class User {

        @Resource
        private UserInfoService userInfoService;

        @RequestMapping("/UserTreeInfo")
        public RespBody getUserTreeInfo(Long id) {
                List<MenuTreeDto> userInfo = userInfoService.getInfoById(id);
                if (userInfo != null && userInfo.size() > 0) {
                        return new RespBody(200,userInfo,"查询成功");
                }
                return new RespBody(400,null,"查询失败");
        }

}
